package cn.mahjong.utils;

import cn.hutool.core.util.ObjectUtil;
import cn.mahjong.bean.MahJongBean;

import java.util.*;

/**
 * 麻将获取
 */
public class MahJongUtil {
    private static final List<MahJongBean> DATA = new ArrayList<>();

    static {
        for (int i = 1; i < 10; i++) {
            for (int j = 1; j < 5; j++) {
                DATA.add(new MahJongBean(MahJongBean.MahJongBeanType.TIAO, i));
                DATA.add(new MahJongBean(MahJongBean.MahJongBeanType.TONG, i));
                DATA.add(new MahJongBean(MahJongBean.MahJongBeanType.WAN, i));
            }
        }
    }

    /**
     * 获取随机麻将
     *
     * @return
     */
    public static List<MahJongBean> getRandMahJong() {
        List<MahJongBean> clone = ObjectUtil.clone(DATA);
        Collections.shuffle(clone);
        return clone;
    }

}
